﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain.Core.Specification;
using Domain.MainModule.Entities;

namespace Domain.MainModule.VirtualAccounts
{
    public class VirtualAccountVirtualAccountIdSpecification: Specification<VirtualAccount>
    {
        Guid _virtualAccountId;

        public VirtualAccountVirtualAccountIdSpecification(Guid virtualAccountId)
        {
            this._virtualAccountId = virtualAccountId;
        }

        public override System.Linq.Expressions.Expression<Func<VirtualAccount, bool>> SatisfiedBy()
        {
            Specification<VirtualAccount> spec = new TrueSpecification<VirtualAccount>();

            spec &= new DirectSpecification<VirtualAccount>(t => t.IsEnabled);

            spec &= new DirectSpecification<VirtualAccount>(c => c.VirtualAccountId == this._virtualAccountId);

            return spec.SatisfiedBy();
        }

    }
}
